/*
 * Copyright (c) 2020 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Remove container padding from TreeOutline.
 * Allows issues to touch the edges of the container. */
:host,
.issues {
  padding: 0;
  overflow: auto;
}

.issues {
  --breaking-change-color: #f29900;
  --issue-gray: #5f6368;
  --issue-link: #1967d2;
  --issue-black: #202124;
  --affected-resource-background: #f8f9fa;
}

:host-context(.-theme-with-dark-background) .issues {
  --issue-gray: #a09c97;
  --issue-black: #dfdedb;
  --affected-resource-background: #070605;
}

/* Override whitespace behavior for tree items to allow wrapping */
.issues li {
  white-space: normal;
}

/* Hide toggle for tree items which cannot be collapsed */
.issues .always-parent::before {
  display: none;
}

/* Override TreeOutline toggle switching to allow animation */
.issues li.parent::before {
  transition: transform 200ms;
  transform-origin: 25% 50%;
}
.issues li.parent.expanded::before {
  -webkit-mask-position: 0 0;
  transform: rotate(90deg);
}

.issue {
  padding: 0 8px;
  overflow: hidden;
  flex: none;
  transition: background-color 200ms;
  background: #f3f3f3;
  border: 1px solid #e5e5e5;
  border-width: 0 0 1px;
}

.issue.expanded {
  background: #ffffff;
  border-width: 0;
}

.issue::before {
  /* Move toggle for issue items to the right */
  order: 3;
  /* Point toggle arrow up for issue items when closed */
  transform: rotate(180deg);
}

p {
  margin-block-start: 2px;
  margin-block-end: 2px;
}

/* Override selected tree item styles for issues to avoid changing width. */
.tree-outline-disclosure:not(.tree-outline-disclosure-hide-overflow)
  .tree-outline.hide-selection-when-blurred
  .issue.selected:focus[data-keyboard-focus='true'] {
  width: auto;
  padding-right: 8px;
}

.header {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 6px 0;
  cursor: pointer;
  width: 100%;
}

.icon {
  margin-right: 4px;
}

.title {
  flex: 1;
  font-size: 14px;
  color: var(--issue-black);
  font-weight: normal;
}

.issue.expanded .title {
  font-weight: 450;
}

.body.children {
  border-bottom: 1px solid #e5e5e5;
  padding: 6px 0;
  position: relative;
  padding-left: 38.5px;
  padding-bottom: 26px;
  padding-right: 8px;
}

/* Show a colored border on the left side of opened issues. */
.body::before {
  content: '';
  display: block;
  position: absolute;
  left: 17.5px;
  top: 0;
  bottom: 20px;
  border-left: 2px solid var(--breaking-change-color);
  width: 2px;
}

.message {
  line-height: 20px;
  font-size: 14px;
  color: var(--issue-gray);
  margin-bottom: 4px;
}

.message .example {
  margin-top: 2px;
  margin-bottom: 2px;
}

.message .example code {
  color: var(--issue-black);
  font-size: 90%;
  user-select: text;
  cursor: text;
}

.message .example .comment::before {
  content: ' — ';
}

.kind-code-line {
  font-size: 12px;
  color: var(--issue-gray);
  margin-bottom: 4px;
  user-select: none;
}

.separator::before {
  content: '·';
  padding-left: 1ex;
  padding-right: 1ex;
}

.issue-code {
  color: rgba(95, 99, 104, 0.5);
  user-select: text;
  cursor: text;
}

.issue-kind {
  color: var(--breaking-change-color);
}

.link {
  font-size: 14px;
  color: var(--issue-link);
}

.link-wrapper {
  margin-top: 8px;
}

.affected-resources-label,
.resolutions-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 2em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--issue-black);
}

.resolutions-list {
  list-style-type: circle;
  padding-inline-start: 20px;
}

/* We inherit all the styles from treeoutline, but these are simple text <li>, so we override some styles */
.resolutions-list li::before {
  content: none;
  -webkit-mask-image: none;
}

.resolutions-list li {
  display: list-item;
}

.affected-resources {
  background: var(--affected-resource-background);
  padding: 12px 3px 12px 20px;
  position: relative;
}

.affected-resource-label {
  font-size: 14px;
  line-height: 20px;
  color: var(--issue-black);
  position: relative;
  cursor: pointer;
}

.affected-resource-cookie {
  font-size: 14px;
  line-height: 20px;
  color: var(--issue-link);
  border: 0;
  border-collapse: collapse;
}

.affected-resource-request {
  font-size: 14px;
  line-height: 20px;
  color: var(--issue-link);
  border: 0;
  border-collapse: collapse;
}

.affected-resource-list {
  border-spacing: 0;
}

.affected-resource-header {
  font-size: 12px;
  color: rgba(95, 99, 104, 0.5);
}

.affected-resource-header-info {
  padding-left: 16px;
}

.affected-resource-cookie-info {
  color: var(--issue-gray);
  padding-left: 16px;
}
